package com.example.mq.mqserver.mapper;

import com.example.mq.mqserver.core.Binding;
import com.example.mq.mqserver.core.Exchange;
import com.example.mq.mqserver.core.MSGQueue;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: DongGuoZhen
 * @Date: 2024/02/22/16:34
 * @Description:
 */
@Mapper
public interface MetaMapper {
    //提供三个核心的建表方法
    void createExchangeTable();
    void createQueueTable();
    void createBindingTable();

    //针对上述三个基本概念进行插入和删除
    void insertExchange(Exchange exchange);
    void deleteExchange(String exchangeName);
    //查找所有交换机
    List<Exchange> selectAllExchanges();


    void insertQueue(MSGQueue msgQueue);
    void deleteQueue(String queueName);
    List<MSGQueue> selectAllQueues();

    //对于交换机和队列两张表,由于使用name作为主键,可以直接按照name来进行删除
    //对于绑定来说,没有主键,删除操作其实是对exchangeName和queueName两个维度来删除
    void insertBinding(Binding binding);
    void deleteBinding(Binding binding);
    List<Binding> selectAllBindings();


}
